import datetime

from peewee import *
from model.basemodel import BaseModel, db


class User(BaseModel):
    id = CharField(max_length=55, column_name="id")
    wx_openid = CharField(max_length=32, column_name="wx_openid", default=None)
    wx_unionid = CharField(max_length=50, column_name="wx_unionid", default=None)
    qq_openid = CharField(max_length=32, column_name="qq_openid", default=None)
    username = CharField(max_length=64)
    name = CharField(max_length=16)
    password_enrpt = CharField(max_length=55, column_name ="password_enrpt", default=None)
    nickname = CharField(max_length=32, default=None)

    create_date = DateTimeField(default=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
    last_login_date = DateTimeField(default=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), column_name="last_login_date")
    last_contact_date = DateTimeField(column_name="last_contact_date", default=None)
    telephone = CharField(max_length=11)
    email = CharField(max_length=64, default=None)
    qq = CharField(max_length=32, default=None)
    weixin = CharField(max_length=32, default=None)
    birthday = DateField(default=None)
    salary = CharField(max_length=32, default=None)
    edu_level = CharField(max_length=4, default=None)
    skill_level = CharField(max_length=4, default=None)
    work_company = CharField(max_length=32, default=None)
    address = CharField(max_length=64, default=None)
    referrerId = CharField(max_length=55, default=None)
    points = IntegerField(default=0)
    user_status = SmallIntegerField(default=1)
    assistantId = IntegerField(default=0)
    sex = CharField(max_length=2, default=None)
    head_portrait = CharField(max_length=255, default=None)
    signin_date = DateTimeField(default=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), column_name="signin_date")
    signin = IntegerField(default=0)
    study_time = IntegerField(default=0)

    class Meta:
        table_name = "t_user"
